package payment

import "fmt"

// 支付宝支付
type Alipay struct {
}

func NewAlipay() *Alipay {
	return &Alipay{}
}

// 支付方法
func (a *Alipay) Pay(amount int64) (string, error) {
	fmt.Printf("alipay pay %d\n", amount)
	return "alipay_pay_success", nil
}

// 风控检查
func (a *Alipay) RiskCheck(amount int64) bool {
	fmt.Printf("alipay risk check %d\n", amount)
	return true
}

// 退款方法
func (a *Alipay) Refund(orderId string) error {
	fmt.Printf("alipay refund %s\n", orderId)
	return nil
}

// AlipayFactory 支付宝支付网关工厂
type AlipayFactory struct {
}

func NewAlipayFactory() *AlipayFactory {
	return &AlipayFactory{
	}
}

func (a *AlipayFactory) Create() Payment {
	return NewAlipay()
}
